博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Flask的基本操作知识
阅读量:6864 次
发布时间:2019-06-26

本文共 1063 字,大约阅读时间需要 3 分钟。

https://study.163.com/course/courseLearn.htm?courseId=1005913008&from=study#/learn/video?lessonId=1053446514&courseId=1005913008

学习了flask的基本知识,做下笔记

首先创建项目后在编辑结构里勾选上单一实例和DEBUG。

1 from flask import Flask, render_template, request, redirect 2  3 app = Flask(__name__) 4  5  6 @app.route('/') 7 def hello_world(): 8     # 通过url传递参数 9     wd = request.args.get('wd')10     age = request.args.get('age')11     print(wd)12     print(age)13     return '好好学习'+wd14 15 16 @app.route('/index', methods=['GET', 'POST'])17 def index():18     # 表单参数传递19     if request.method == 'GET':20         return render_template('index.html')21     else:22         tel = request.form.get('tel')23         pwd = request.form.get('pwd')24         print('tel:%s'%tel)25         print('pwd:%s'%pwd)26         # 重定向27         return redirect('/profile/')28 29 30 @app.route('/profile/')31 def profile():32     return "个人中心页面"33 34 35 if __name__ == '__main__':36     app.run()

index的代码

  

登录窗口界面

 

转载于:https://www.cnblogs.com/weiwei2016/p/10167364.html

你可能感兴趣的文章
谈谈技术规范的制定
查看>>
ubuntu12.04mtk编译环境安装
查看>>
Haproxy负载均衡比较
查看>>
inittab文件被删除的修复方法
查看>>
三种进制相互转化
查看>>
《Clean Code》重点内容总结
查看>>
SBO数据库服务器规划
查看>>
sql server 2008 r2 导出数据到Excel
查看>>
二分查找的java实现
查看>>
Linux下安装redmine,及apache的支持
查看>>
Tomcat优化配置
查看>>
手持终端的优势有哪些
查看>>
Oracle 绑定变量
查看>>
NagiosQL添加监控主机及Nagios上启用报警机制
查看>>
我的友情链接
查看>>
Tomcat 监控及远程日志查看工具psi-probe
查看>>
学习Visual C++实例精通 第14章 网络开发
查看>>
前端小报14-11-9
查看>>
Java解析文件内容
查看>>
掌握基于消息与.Net Remoting的分布式处理架构相关详细知识
查看>>